// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.IndexManagement
{
	public sealed partial class SettingsSimilarityScriptedTfidf
	{
		[JsonInclude]
		[JsonPropertyName("script")]
		public Elastic.Clients.Elasticsearch.Script Script { get; set; }

		[JsonInclude]
		[JsonPropertyName("type")]
		public string Type => "scripted";
	}

	public sealed partial class SettingsSimilarityScriptedTfidfDescriptor : SerializableDescriptorBase<SettingsSimilarityScriptedTfidfDescriptor>
	{
		internal SettingsSimilarityScriptedTfidfDescriptor(Action<SettingsSimilarityScriptedTfidfDescriptor> configure) => configure.Invoke(this);
		public SettingsSimilarityScriptedTfidfDescriptor() : base()
		{
		}

		private Elastic.Clients.Elasticsearch.Script ScriptValue { get; set; }

		public SettingsSimilarityScriptedTfidfDescriptor Script(Elastic.Clients.Elasticsearch.Script script)
		{
			ScriptValue = script;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			writer.WritePropertyName("script");
			JsonSerializer.Serialize(writer, ScriptValue, options);
			writer.WritePropertyName("type");
			writer.WriteStringValue("scripted");
			writer.WriteEndObject();
		}
	}
}